package cn.tedu._05interceptor.base.config;

import cn.tedu._05interceptor.base.interceptor.int1;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class config implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new int1())
                .addPathPatterns("/user/**");// 拦截所有请求
        registry.addInterceptor(new int1())
                .addPathPatterns("/user/reg","/user/reg,login");// 拦截指定请求
        registry.addInterceptor(new int1())
                .addPathPatterns("/user/**")
                .excludePathPatterns("/user/reg");// 排除指定请求

    }
}
